<%@page contentType="text/html" pageEncoding="iso-8859-1"%>

<%@ taglib prefix="layout" uri="/WEB-INF/tlds/layout.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<jsp:useBean id="status" scope="request" class="java.lang.String"/>
<jsp:useBean id="resultadoBusca" scope="request" class="avaliacao.DTO.DTOAvaliador"/>
<jsp:useBean id="avaliador" scope="session" class="avaliacao.DTO.DTOAvaliador"/>
<c:set var="grupo" scope="page">
    <jsp:getProperty name="avaliador" property="grupo"/>
</c:set>

<c:import var="menuAdmin" url="/menuAdmin.jsp"/>

<layout:head>
    <%-- Insert extra scripts and styles here --%>
</layout:head>

<layout:body handler="FormularioAvaliador" form="true" method="post">
    <c:choose>
        <c:when test="${grupo == 'admin'}" >
            ${menuAdmin}

            <div id="main">
                <table>
                    <tr>
                        <td colspan="2" align="center">
                            <u><h1>Cadastro de Avaliador</h1></u>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <br>
                            Login:
                        </td>
                        <td>
                            <br>
                            <input name="login" type="text" size="30" maxlength="20"/>*
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <br>
                            Nome:
                        </td>
                        <td align="left">
                            <br>
                            <input name="nome" type="text" size="80" maxlength="60"/>*
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <br>
                            Email:
                        </td>
                        <td align="left">
                            <br>
                            <input name="email" type="text" size="80" maxlength="50"/>*
                        </td>
                    </tr>
                    <c:if test="${avaliador.grupo == 'admin'}">
                        <tr>
                            <td>
                                <br>
                                Permiss&atilde;o:
                            </td>
                            <td align="left">
                                <br>
                                <select name="grupo"  >
                                    <option value="admin">Administrador</option>
                                    <option value="avaliador" <c:if test="${resultadoBusca.grupo == 'avaliador'}">selected </c:if>>Avaliador</option>
                                </select>
                            </td>
                        </tr>
                    </c:if>
                    <tr>
                        <td align="right" colspan="2">
                            <font size="-1" color="red">Os campos assinalados com * s&atilde;o obrigat&oacute;rios.</font>
                            <br>
                            <br>
                            <input type="submit" name="submeter" value="Salvar" onclick="submitForm('submeterFormAvaliador')"/>
                            <br>
                            <br>

                            <div id="status">
                                <%=status%>
                            </div>

                            <br>
                            <br>
                            <br>
                            <br>
                            <br>
                            <br>
                            <br>
                            <br>
                            <br>
                            <br>
                        </td>
                    </tr>
                </table>
            </div>

        </c:when>
        <c:otherwise>
            Voc&ecirc; n&atilde;o tem permiss&atilde;o para acessar esta p&aacute;gina.
        </c:otherwise>
    </c:choose>
</layout:body>